namespace ConsoleApp.Model.Dto;

public class AjaxResult
{

    public int code { get; set; } = 200;
    
    public string msg { get; set; } = string.Empty;
    
    public object data { get; set; } = null;


    public static AjaxResult Success(object data = null)
    {
        return new AjaxResult()
        {
            code = 200,
            msg = "Success",
            data = data
        };
    }
    
    
    public static AjaxResult Error(string msg = "system error")
    {
        return new AjaxResult()
        {
            code = 500,
            msg = msg
        };
    }
    
    public static AjaxResult Response(int code = 200,string msg = "Done",object data = null)
    {
        return new AjaxResult()
        {
            code = code,
            msg = msg,
            data = data
        };
    }
    
    
}